import * as echarts from "../../ec-canvas/echarts";
// 仪表盘
function getOption(data) {
  let option = {
    series: [
      {
        type: "gauge",
        startAngle: 190, // 开始角度 左侧角度
        endAngle: -10, // 结束角度 右侧
        radius: "150%",
        center: ["50%", "85%"],
        axisLine: {
          lineStyle: {
            width: 10,
            color: [
              [
                1,
                new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                  {
                    offset: 0.1,
                    color: "#5cb494",
                  },
                  {
                    offset: 0.35,
                    color: "#e1cc5b",
                  },
                  {
                    offset: 0.7,
                    color: "#f8b76a",
                  },
                  {
                    offset: 1,
                    color: "#ec5145",
                  },
                ]),
              ],
            ],
          },
        },
        pointer: {
          itemStyle: {
            color: "#ec5246",
          },
        },
        axisTick: {
          show: false,
        },
        axisLabel: {
          color: "#989898",
          distance: 0,
          fontSize: 12,
          formatter: function (param) {
            if (param % 20 == 0) {
              return param;
            }
          },
        },
        splitLine: {
          show: false,
        },
        detail: {
          show: false,
        },
        data: [
          {
            value: data.allData.score,
          },
        ],
      },
    ],
  };
  return option;
}
module.exports = {
  //必须在这里暴露接口，以便被外界访问，不然就不能访问
  getOption: getOption,
};
